const koa = require("koa")
const app = new koa();
const cors = require('koa-cors')
const router = require('koa-router')()
const mainRouter = require('./routes/index')
const searchRouter = require('./routes/search')
const vediosRouter = require('./routes/videos')
const rankingRouter = require('./routes/ranking')
const transferRouter = require('./routes/transfer')

// 挂载跨域中间件
app.use(cors())
app.use(mainRouter)
router.use('/search', searchRouter)
router.use('/videos', vediosRouter)
router.use('/ranking', rankingRouter)
router.use('/transfer', transferRouter)
app.use(router.routes())

app.listen(1314, () => {
    console.log("Your App is running")
})